﻿using System.Data.Entity.ModelConfiguration;

namespace HobSoft.SoccerBet2014.Domain.Models.DbSchema
{
    public class BFMarketConfiguration : EntityTypeConfiguration<BFMarket>
    {
        public BFMarketConfiguration(string schema = "dbo")
        {
            ToTable(schema + ".BFMarkets");
            HasKey(m => m.MarketID);
            HasRequired(m => m.Event).WithMany(be => be.Markets).HasForeignKey(m => m.EventID);
            Property(m => m.EventID).HasColumnName("EventID").IsRequired();
            Property(m => m.MarketID).HasColumnName("MarketID").IsRequired().HasMaxLength(50).IsUnicode(false);
            Property(m => m.MarketName).HasColumnName("MarketName").IsRequired().HasMaxLength(50);
            Property(m => m.CategoryID).HasColumnName("MarketCategory").IsRequired();
            Property(m => m.State).HasColumnName("MarketStatus").IsRequired().HasMaxLength(50).IsUnicode(false);
            Property(m => m.UpdateTime).HasColumnName("MarketTime").IsOptional();
            Property(m => m.TypeName).HasColumnName("MarketType").IsOptional().HasMaxLength(50);
            //Ignore(m => m.Runners);
            Ignore(m => m.Key);
        }
    }
}
